using Spine.Unity;
using System.Collections;
using UnityEngine;
using UnityEngine.Events;

public class TutorialPanel : MonoBehaviour
{
	private UnityAction action;

	private SkeletonGraphic spine;

	private Animator anim;

	private Coroutine blockControlls;

	private void Awake()
	{
		spine = GetComponentInChildren<SkeletonGraphic>();
		anim = GetComponent<Animator>();
		blockControlls = StartCoroutine(BlockControls());
	}

	private IEnumerator BlockControls()
	{
		WaitForEndOfFrame waitForEndOfFame = new WaitForEndOfFrame();
		while (true)
		{
			BottleController.blockAllBottlesController = true;
			ButtonPickLiquidController.blockAllButtonPickLiquidController = true;
			yield return waitForEndOfFame;
		}
	}

	public void SetOnClickAction(UnityAction action)
	{
		this.action = action;
	}

	public void OnClickButtonOk()
	{
		anim.SetTrigger("Hide");
		AudioController.instance.Play("button");
		if (action != null)
		{
			action();
		}
	}

	public void OnEndHide()
	{
		StopCoroutine(blockControlls);
		BottleController.blockAllBottlesController = false;
		ButtonPickLiquidController.blockAllButtonPickLiquidController = false;
		UnityEngine.Object.Destroy(base.gameObject);
	}

	public void OnEndShow()
	{
		//spine.freeze = false;
	}
}
